package com.gwd.task.controller;

import com.gwd.task.enums.VersionEnum;
import com.gwd.task.model.VersionDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @author zhiyongming
 * @date 2020/11/11 10:59
 */
@RestController
@RequestMapping(value = "/v1/version")
public class VersionController {

    @GetMapping(value = "/findVersion")
    public List<VersionDTO> findVersion() {
        List<VersionDTO> list = new ArrayList<>();
        VersionEnum[] values = VersionEnum.values();
        for (VersionEnum value : values) {
            Integer key = value.getId();
            String v = value.getVersion();
            list.add(new VersionDTO(key, v));
        }
        return list;
    }
}
